package com.liuyu.common.framework.rocketmq.kits;

import lombok.Getter;

/**
 * @ClassName RocketLevelEnum
 *
 * @Author: liuyu
 * @Date: Created in 2021/8/19 16:12
 * @Version: 1
 * @Modified By:
 */
@Getter
public enum RocketLevelEnum {
    //    1s(0) 5s(1) 10s(2) 30s(3) 1m(4) 2m(5) 3m(6) 4m 5m 6m 7m 8m 9m 10m 20m 30m 1h 2h
    ONE_SECOND(1, "1秒"), FIVE_SECOND(2, "5秒"), TEN_SECOND(3, "10秒"), THIRTY_SECOND(4, "30秒"), ONE_MINUTE(5, "1分"), TWO_MINUTE(6, "2分"), THIRD_MINUTE(7, "3分"), FOUR_MINUTE(8, "4分"), FIVE_MINUTE(9, "5分"), SIX_MINUTE(10, "6分"), SEVEN_MINUTE(11, "7分"), EIGHT_MINUTE(12, "8分"), NINE_MINUTE(13, "9分"), TEN_MINUTE(14, "10分"), TWENTY_MINUTE(15, "20分"), THIRTY_MINUTE(16, "30分"), ONE_HOUR(17, "1小时"), TWO_HOUR(18, "2小时");
    private Integer level;
    private String name;

    RocketLevelEnum(Integer level, String name) {
        this.level = level;
        this.name = name;
    }


    /**
     *将数值转换成枚举值
     * @author liuyu
     * @date 2022/8/9 0:21
     * @throws
     * @return
     */
    public static RocketLevelEnum createRocketLevelEnum(int value) {
        switch (value) {
            case 1:
                return ONE_SECOND;
            case 2:
                return FIVE_SECOND;
            case 3:
                return TEN_SECOND;
            case 4:
                return THIRTY_SECOND;
            case 5:
                return ONE_MINUTE;
            case 6:
                return TWO_MINUTE;
            case 7:
                return THIRD_MINUTE;
            case 8:
                return FOUR_MINUTE;
            case 9:
                return FIVE_MINUTE;
            case 10:
                return SIX_MINUTE;
            case 11:
                return SEVEN_MINUTE;
            case 12:
                return EIGHT_MINUTE;
            case 13:
                return NINE_MINUTE;
            case 14:
                return TEN_MINUTE;
            case 15:
                return TWENTY_MINUTE;
            case 16:
                return THIRTY_MINUTE;
            case 17:
                return ONE_HOUR;
            case 18:
                return TWO_HOUR;
            default:
                return null;
        }
    }
}
